package com.pulaien.shop.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.pulaien.common.utils.SecurityUtils;
import com.pulaien.system.domain.RakutenOrder;
import com.pulaien.system.domain.dto.RakutenInventoryParam;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.pulaien.common.annotation.Log;
import com.pulaien.common.core.controller.BaseController;
import com.pulaien.common.core.domain.AjaxResult;
import com.pulaien.common.enums.BusinessType;
import com.pulaien.system.domain.RakutenInventory;
import com.pulaien.system.service.IRakutenInventoryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import com.pulaien.common.utils.poi.ExcelUtil;
import com.pulaien.common.core.page.TableDataInfo;

/**
 * 乐天库存信息Controller
 *
 * @author pulaien
 */
@RestController
@RequestMapping("/shop/rakuten/inventory")
@Api(tags = "乐天库存信息")
public class ShopRakutenInventoryController extends BaseController
{
    @Autowired
    private IRakutenInventoryService rakutenInventoryService;

    /**
     * 查询乐天库存信息列表
     */
    @ApiOperation(value = "乐天库存信息列表")
    @GetMapping("/list")
    public TableDataInfo list(RakutenInventoryParam rakutenInventory)
    {
        startPage();
        List<RakutenInventory> list = rakutenInventoryService.list(rakutenInventory);
        return getDataTable(list);
    }

    /**
     * 同步最新库存
     */
    @ApiOperation(value = "同步最新库存")
    @GetMapping("/synchronousInventory")
    public AjaxResult synchronousInventory(RakutenInventory rakutenInventory)
    {
        return rakutenInventoryService.synchronousInventory(SecurityUtils.getUserId());
    }


}
